package com.ruoyi.business.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.business.mapper.JtDistributorLevelMapper;
import com.ruoyi.business.domain.JtDistributorLevel;
import com.ruoyi.business.service.IJtDistributorLevelService;
import com.ruoyi.common.core.text.Convert;

/**
 * 分销商等级Service业务层处理
 * 
 * @author Alan Zhang
 * @date 2025-06-17
 */
@Service
public class JtDistributorLevelServiceImpl implements IJtDistributorLevelService 
{
    @Autowired
    private JtDistributorLevelMapper jtDistributorLevelMapper;

    /**
     * 查询分销商等级
     * 
     * @param levelId 分销商等级主键
     * @return 分销商等级
     */
    @Override
    public JtDistributorLevel selectJtDistributorLevelByLevelId(Long levelId)
    {
        return jtDistributorLevelMapper.selectJtDistributorLevelByLevelId(levelId);
    }

    /**
     * 查询分销商等级列表
     * 
     * @param jtDistributorLevel 分销商等级
     * @return 分销商等级
     */
    @Override
    public List<JtDistributorLevel> selectJtDistributorLevelList(JtDistributorLevel jtDistributorLevel)
    {
        return jtDistributorLevelMapper.selectJtDistributorLevelList(jtDistributorLevel);
    }

    /**
     * 新增分销商等级
     * 
     * @param jtDistributorLevel 分销商等级
     * @return 结果
     */
    @Override
    public int insertJtDistributorLevel(JtDistributorLevel jtDistributorLevel)
    {
        jtDistributorLevel.setCreateTime(DateUtils.getNowDate());
        return jtDistributorLevelMapper.insertJtDistributorLevel(jtDistributorLevel);
    }

    /**
     * 修改分销商等级
     * 
     * @param jtDistributorLevel 分销商等级
     * @return 结果
     */
    @Override
    public int updateJtDistributorLevel(JtDistributorLevel jtDistributorLevel)
    {
        return jtDistributorLevelMapper.updateJtDistributorLevel(jtDistributorLevel);
    }

    /**
     * 批量删除分销商等级
     * 
     * @param levelIds 需要删除的分销商等级主键
     * @return 结果
     */
    @Override
    public int deleteJtDistributorLevelByLevelIds(String levelIds)
    {
        return jtDistributorLevelMapper.deleteJtDistributorLevelByLevelIds(Convert.toStrArray(levelIds));
    }

    /**
     * 删除分销商等级信息
     * 
     * @param levelId 分销商等级主键
     * @return 结果
     */
    @Override
    public int deleteJtDistributorLevelByLevelId(Long levelId)
    {
        return jtDistributorLevelMapper.deleteJtDistributorLevelByLevelId(levelId);
    }
}
